From bb29b4d803923afea02b9c59cf1d78dc1ff8dfaa Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Sun, 21 Oct 2018 18:23:19 -0500 Subject: [PATCH] Fix remianing flake8 ENNN and WNNN problems --- src/pgwui_core/pgwui_core.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/pgwui_core/pgwui_core.py b/src/pgwui_core/pgwui_core.py index a1e979f..1ad4a15 100644 --- a/src/pgwui_core/pgwui_core.py +++ b/src/pgwui_core/pgwui_core.py @@ -289,8 +289,8 @@ class CredsLoadedForm(LoadedForm): Produces the dict pyramid will use to render the form. ''' response = super(CredsLoadedForm, self).write(result, errors) - if ('havecreds' not in response - or ('havecreds' in response and not response['havecreds'])): + if ('havecreds' not in response or + ('havecreds' in response and not response['havecreds'])): # We don't know if the credentials are good or # we know they are bad. Keep them out of the session. response['user'] = '' @@ -1019,7 +1019,7 @@ class UploadData(DBData): self.lineno += 1 # Intuit the eol sequence if line[-2:] == '\r\n': - eol = '\r\n'; + eol = '\r\n' line = line[:-2] elif line[-1:] == '\n': eol = '\n' @@ -1071,9 +1071,10 @@ class UploadData(DBData): # Create mapper to frob data elements if null_data: null_rep = do_trim(null_rep) - # psycopg2 maps None to NULL + def mapper(st): st = do_trim(st) + # psycopg2 maps None to NULL return None if st == null_rep else st self._mapper = mapper else: @@ -1359,10 +1360,10 @@ class UploadHandler(SessionDBHandler): uf = self.uf if self.make_double_key() == uf['last_key']: errors.append(DuplicateUploadError( - 'File just uploaded to this db', - ('File named ({0}) just uploaded' - .format(markupsafe.escape(uf['filename']))), - '

Try again to force upload.

')) + 'File just uploaded to this db', + ('File named ({0}) just uploaded' + .format(markupsafe.escape(uf['filename']))), + '

Try again to force upload.

')) def hash_sequence(self, seq): '''Produce a hash of the elements of a sequence.''' @@ -1420,8 +1421,8 @@ class UploadHandler(SessionDBHandler): if hasattr(self, 'data'): response['lines'] = self.data.lineno - 1 response['e_cnt'] = len(errors) - response['db_changed'] = (not response['errors'] - and self.uf['action'] != '') + response['db_changed'] = (not response['errors'] and + self.uf['action'] != '') return response @@ -1631,7 +1632,7 @@ class DBConnector(object): errors = self.call_alter_db(func, conn) response.update({'havecreds': havecreds - }) + }) return (errors, response) def read_uh(self): -- 2.34.1